package com.token.sysflow.bean;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import com.token.sql.IntegrateSql;
import com.token.sql.AbstractTableBean;
/**
 * 流向信息
 * @author 代码创建
 */
public class FlowPathInfo extends AbstractTableBean {

	private String PathId; //流向ID
	private String FlowId; //流程ID
	private int SysId; //租户ID
	private String SysAddTime; //创建时间
	private String SysAddUser; //创建人
	private String SysEditTime; //修改时间
	private String SysEditUser; //修改人
	private int SerialNumber; //序号
	private String FromStepId; //开始环节ID
	private String ToStepId; //目标环节ID
	private String PathName; //流向名称

	public static String TABLE_NAME = "Flow_PathInfo";
	public static String TABLEKEY_NAME = "PathId";
	public FlowPathInfo (IntegrateSql f){
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
	}

	public FlowPathInfo (IntegrateSql f,ResultSet rs) throws SQLException{
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
		this.initParamToRs(rs);
	}

	public FlowPathInfo (IntegrateSql f,String keyValue) throws SQLException{
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
		setCodePrepare(selectCodeById().toString());
		prepareSql.setPstValue(1, keyValue);
		ResultSet rs = executeQuery();
		if(rs.next()){
			initParamToRs(rs);
		}else{
			initParam();
		}
		rs.close();
	}

	@Override
	protected void initParam() {
		PathId = ""; //流向ID
		FlowId = ""; //流程ID
		SysId = 0; //租户ID
		SysAddTime = ""; //创建时间
		SysAddUser = ""; //创建人
		SysEditTime = ""; //修改时间
		SysEditUser = ""; //修改人
		SerialNumber = 0; //序号
		FromStepId = ""; //开始环节ID
		ToStepId = ""; //目标环节ID
		PathName = ""; //流向名称
	}


	public void initParamToRs(ResultSet rs) throws SQLException{
		PathId = rs.getString("PathId"); //流向ID
		FlowId = rs.getString("FlowId"); //流程ID
		SysId = rs.getInt("SysId"); //租户ID
		SysAddTime = rs.getString("SysAddTime"); //创建时间
		SysAddUser = rs.getString("SysAddUser"); //创建人
		SysEditTime = rs.getString("SysEditTime"); //修改时间
		SysEditUser = rs.getString("SysEditUser"); //修改人
		SerialNumber = rs.getInt("SerialNumber"); //序号
		FromStepId = rs.getString("FromStepId"); //开始环节ID
		ToStepId = rs.getString("ToStepId"); //目标环节ID
		PathName = rs.getString("PathName"); //流向名称
		this.setKeyId(rs.getString("PathId"));
	}


	@Override
	protected int appendData() throws SQLException {
		int i = 1;
		prepareSql.setPstValue(i++,PathId); //流向ID
		prepareSql.setPstValue(i++,FlowId); //流程ID
		prepareSql.setPstValue(i++,SysId); //租户ID
		prepareSql.setPstValue(i++,SysAddTime); //创建时间
		prepareSql.setPstValue(i++,SysAddUser); //创建人
		prepareSql.setPstValue(i++,SysEditTime); //修改时间
		prepareSql.setPstValue(i++,SysEditUser); //修改人
		prepareSql.setPstValue(i++,SerialNumber); //序号
		prepareSql.setPstValue(i++,FromStepId); //开始环节ID
		prepareSql.setPstValue(i++,ToStepId); //目标环节ID
		prepareSql.setPstValue(i++,PathName); //流向名称
		return i;
	}


	@Override
	public Vector<String> getFields() {
		Vector<String> vec = new Vector<String>();
		vec.addElement("PathId"); //流向ID
		vec.addElement("FlowId"); //流程ID
		vec.addElement("SysId"); //租户ID
		vec.addElement("SysAddTime"); //创建时间
		vec.addElement("SysAddUser"); //创建人
		vec.addElement("SysEditTime"); //修改时间
		vec.addElement("SysEditUser"); //修改人
		vec.addElement("SerialNumber"); //序号
		vec.addElement("FromStepId"); //开始环节ID
		vec.addElement("ToStepId"); //目标环节ID
		vec.addElement("PathName"); //流向名称
		return vec;
	}


	/**
	 * 设置流向ID
	 * @param pathid
	 */
	public void setPathId(String pathid){
		PathId = pathid;
	}
	/**
	 * 获取PathId
	 * @return 流向ID
	 */
	public String getPathId(){
		return PathId;
	}

	/**
	 * 设置流程ID
	 * @param flowid
	 */
	public void setFlowId(String flowid){
		FlowId = flowid;
	}
	/**
	 * 获取FlowId
	 * @return 流程ID
	 */
	public String getFlowId(){
		return FlowId;
	}

	/**
	 * 设置租户ID
	 * @param sysid
	 */
	public void setSysId(int sysid){
		SysId = sysid;
	}
	/**
	 * 获取SysId
	 * @return 租户ID
	 */
	public int getSysId(){
		return SysId;
	}

	/**
	 * 设置创建时间
	 * @param sysaddtime
	 */
	public void setSysAddTime(String sysaddtime){
		SysAddTime = sysaddtime;
	}
	/**
	 * 获取SysAddTime
	 * @return 创建时间
	 */
	public String getSysAddTime(){
		return SysAddTime;
	}

	/**
	 * 设置创建人
	 * @param sysadduser
	 */
	public void setSysAddUser(String sysadduser){
		SysAddUser = sysadduser;
	}
	/**
	 * 获取SysAddUser
	 * @return 创建人
	 */
	public String getSysAddUser(){
		return SysAddUser;
	}

	/**
	 * 设置修改时间
	 * @param sysedittime
	 */
	public void setSysEditTime(String sysedittime){
		SysEditTime = sysedittime;
	}
	/**
	 * 获取SysEditTime
	 * @return 修改时间
	 */
	public String getSysEditTime(){
		return SysEditTime;
	}

	/**
	 * 设置修改人
	 * @param sysedituser
	 */
	public void setSysEditUser(String sysedituser){
		SysEditUser = sysedituser;
	}
	/**
	 * 获取SysEditUser
	 * @return 修改人
	 */
	public String getSysEditUser(){
		return SysEditUser;
	}

	/**
	 * 设置序号
	 * @param serialnumber
	 */
	public void setSerialNumber(int serialnumber){
		SerialNumber = serialnumber;
	}
	/**
	 * 获取SerialNumber
	 * @return 序号
	 */
	public int getSerialNumber(){
		return SerialNumber;
	}

	/**
	 * 设置开始环节ID
	 * @param fromstepid
	 */
	public void setFromStepId(String fromstepid){
		FromStepId = fromstepid;
	}
	/**
	 * 获取FromStepId
	 * @return 开始环节ID
	 */
	public String getFromStepId(){
		return FromStepId;
	}

	/**
	 * 设置目标环节ID
	 * @param tostepid
	 */
	public void setToStepId(String tostepid){
		ToStepId = tostepid;
	}
	/**
	 * 获取ToStepId
	 * @return 目标环节ID
	 */
	public String getToStepId(){
		return ToStepId;
	}

	/**
	 * 设置流向名称
	 * @param pathname
	 */
	public void setPathName(String pathname){
		PathName = pathname;
	}
	/**
	 * 获取PathName
	 * @return 流向名称
	 */
	public String getPathName(){
		return PathName;
	}

}
